﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chowpoo.Sql;
using CourseSystem.Core.Entities;

namespace CourseSystem.Core.SqlServerDAL
{
    public class SectionDAL : CommonDal<SectionInfo>
    {
        public SectionDAL(string mConnectionStringName)
            : base(mConnectionStringName)
        {
        }

        public SectionDAL()
            : base(Settings.ConnectionName)
        {

        }

        public SectionInfo SelectMin()
        {
            var dc = DataContext<SectionInfo>.CreateContext(ConnectionStringName);
            dc.DeferredLoadingEnabled = true;
            return dc.SourceTable.OrderBy(o => o.ChapterInfo.OrderId).OrderBy(o => o.OrderId).FirstOrDefault();
        }
    }
}
